/**
 * Copyright (c) 2011 Nokia Corporation.
 */

#ifndef MYGAMEWINDOW_H
#define MYGAMEWINDOW_H

#include <QMouseEvent>

#include "audiobuffer.h"
#include "audiobufferplayinstance.h"
#include "gamewindow.h"


    // Example-specific defines to control the effect
#define NOF_LIGHTS 9            // How many lights are in use
#define LIGHT_SIZE 0.1          // The size of a single light
#define LIGHT_STEP 0.25         // Distance between two lights
#define EXIT_BUTTON_SIZE 0.25f   // The size of the exitbutton at the top right corner of the screen


class MyGameWindow : public GE::GameWindow
{
    Q_OBJECT

public:
    explicit MyGameWindow(QWidget *parent = 0);
    virtual ~MyGameWindow();

public:
        // Override Widget's mouseReleaseEvent to know when
        // user is clicking the close button
    void mouseReleaseEvent( QMouseEvent *e );

protected: // From GameWindow
    void onRender();
    void onUpdate(const float frameDelta);
    void onCreate();
    void onDestroy();

protected: // Data
            // Audio buffer containing the audiosample of this example
    GE::AudioBuffer *hummSoundBuffer;
    GE::AudioBuffer *clickSoundBuffer;

            // Instances for playing the hummsound when light leaves according side.
    GE::AudioBufferPlayInstance leftPlayInstance;
    GE::AudioBufferPlayInstance rightPlayInstance;
        // floats for controlling both of the play instances
    float leftPlayState;
    float rightPlayState;

        // Flare power for each light position
    float flarePower[ NOF_LIGHTS ];
        // Angle for the effect's cosine
    float radarAngle;

        // Shaders and shader program
    GLuint vertexShader;
    GLuint fragmentShader;
    GLuint shaderProgram;

        // Textures to be used
    GLuint socketTexture;
    GLuint flareTexture;
    GLuint exitButtonTexture;
};


#endif // MYGAMEWINDOW_H
